package com.htc.android.footprints.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.ScrollView;

public class HorizontalScrollView extends ScrollView
{
  private static final String TAG = "HorizontalScrollView";
  private float currentX = 0.0F;
  private float currentY = 0.0F;
  private Gesture mGesture;
  private boolean mIsBeingDraggedX = false;
  private boolean mIsBeingDraggedY = false;
  private float mLastMotionX;
  private float mLastMotionY;
  private int mTouchSlopX = 10;

  public HorizontalScrollView(Context paramContext)
  {
    super(paramContext);
  }

  public HorizontalScrollView(Context paramContext, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
  }

  public HorizontalScrollView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
  {
    super(paramContext, paramAttributeSet, paramInt);
  }

  private void viewSwitch()
  {
    if (Math.abs(this.currentY - this.mLastMotionY) > 100.0F)
      Log.i("HorizontalScrollView", "viewSwitch, deltaY = " + Math.abs(this.currentY - this.mLastMotionY));
    while (true)
    {
      return;
      if (this.currentX > this.mLastMotionX)
      {
        if (this.mGesture != null)
          this.mGesture.moveRight();
        Log.i("HorizontalScrollView", "action right");
        continue;
      }
      if (this.mGesture != null)
        this.mGesture.moveLeft();
      Log.i("HorizontalScrollView", "action left");
    }
  }

  public boolean onInterceptTouchEvent(MotionEvent paramMotionEvent)
  {
    int i = paramMotionEvent.getAction();
    int j;
    if ((i == 2) && (this.mIsBeingDraggedX))
      j = 1;
    while (true)
    {
      return j;
      this.mIsBeingDraggedY = super.onInterceptTouchEvent(paramMotionEvent);
      float f1 = paramMotionEvent.getX();
      float f2 = paramMotionEvent.getY();
      switch (i)
      {
      default:
      case 0:
      case 2:
      case 1:
      }
      while (true)
      {
        if ((!this.mIsBeingDraggedX) && (!this.mIsBeingDraggedY))
          break label170;
        j = 1;
        break;
        this.mLastMotionX = f1;
        this.mLastMotionY = f2;
        this.mIsBeingDraggedX = false;
        this.mIsBeingDraggedY = false;
        Log.i("HorizontalScrollView", "Intercept, ACTION_DOWN");
        continue;
        if ((int)Math.abs(f1 - this.mLastMotionX) <= this.mTouchSlopX)
          continue;
        this.mIsBeingDraggedX = true;
        continue;
        this.mIsBeingDraggedX = false;
        this.mIsBeingDraggedY = false;
        Log.i("HorizontalScrollView", "Intercept, ACTION_UP");
      }
      label170: j = 0;
    }
  }

  public boolean onTouchEvent(MotionEvent paramMotionEvent)
  {
    int i = paramMotionEvent.getAction();
    if (!this.mIsBeingDraggedY)
    {
      this.mIsBeingDraggedY = super.onInterceptTouchEvent(paramMotionEvent);
      this.currentX = paramMotionEvent.getX();
      this.currentY = paramMotionEvent.getY();
      switch (i)
      {
      case 2:
      default:
      case 0:
      case 1:
      }
    }
    while (true)
    {
      return true;
      super.onTouchEvent(paramMotionEvent);
      break;
      Log.i("HorizontalScrollView", "onTouch, ACTION_DOWN");
      continue;
      if ((this.mIsBeingDraggedX) && (Math.abs(this.currentX - this.mLastMotionX) > 50.0F))
      {
        viewSwitch();
        this.mIsBeingDraggedX = false;
        this.mIsBeingDraggedY = false;
      }
      Log.i("HorizontalScrollView", "onTouch, ACTION_UP, deltaX = " + Math.abs(this.currentX - this.mLastMotionX));
    }
  }

  public void setGestureCallback(Gesture paramGesture)
  {
    this.mGesture = paramGesture;
  }

  public static abstract interface Gesture
  {
    public abstract void moveLeft();

    public abstract void moveRight();
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.view.HorizontalScrollView
 * JD-Core Version:    0.6.0
 */